import {
	getCompanyAttendance,
	getDepartmentAttendance,
	getUserAttendance,
	getUserAttendanceStat,
	getUserList,
	applyRest,
	applyOvertime,
	getRestLog,
	getOvertimeLog,
	getInitial,
	updateInitial,
	holidaysRest,
	getAuditRsetLog,
	agreeRest,
	refuseRest,
	getAuditOvertimeLog,
	agreeOvertime,
	refuseOvertime,
	getExamineUserList
} from '@/api'

const state = {}

const mutations = {}

const actions = {
	// 获取公司考勤记录
	async getCompanyAttendance({commit}, data) {
		const res = await getCompanyAttendance(data)
		return res
	},
	// 获取部门考勤记录
	async getDepartmentAttendance({commit}, query){
		const res = await getDepartmentAttendance(query)
		return res
	},
	// 获取用户考勤记录
	async getUserAttendance({commit}, query){
		const res = await getUserAttendance(query)
		return res
	},
	// 获取用户考勤统计
	async getUserAttendanceStat({commit}, query){
		const res = await getUserAttendanceStat(query)
		return res
	},
	// 获取用户列表
	async getUserList({commit}){
		const res = await getUserList()
		return res
	},
	// 申请调休
	async applyRest({commit}, body){
		const res = await applyRest(body)
		return res
	},
	// 申请加班
	async applyOvertime({commit}, body){
		const res = await applyOvertime(body)
		return res
	},
	// 查询自己调休申请记录
	async getRestLog({commit}, query){
		const res = await getRestLog(query)
		return res
	},
	// 查询自己加班申请记录
	async getOvertimeLog({commit}, query){
		const res = await getOvertimeLog(query)
		return res
	},
	// 获取初始化考勤数据
	async getInitial({commit}){
		const res = await getInitial()
		return res
	},
	// 更新考勤初始化数据
	async updateInitial({commit}, body){
		const res = await updateInitial(body)
		return res
	},
	// 节假日设置
	async holidaysRest({commit}, body){
		const res = await holidaysRest(body)
		return res
	},
	// 查询有自己审核的信息
	async getAuditRsetLog({commit}, query){
		const res = await getAuditRsetLog(query)
		return res
	},
	// 同意调休申请
	async agreeRest({commit}, body){
		const res = await agreeRest(body)
		return res
	},
	// 驳回调休申请
	async refuseRest({commit}, body){
		const res = await refuseRest(body)
		return res
	},
	// 查询有自己审核的信息
	async getAuditOvertimeLog({commit}, query){
		const res = await getAuditOvertimeLog(query)
		return res
	},
	// 同意加班申请
	async agreeOvertime({commit}, body){
		const res = await agreeOvertime(body)
		return res
	},
	// 驳回加班申请
	async refuseOvertime({commit}, body){
		const res = await refuseOvertime(body)
		return res
	},
	// 获取具备审核权限的人列表
	async getExamineUserList({commit}, query){
		const res = await getExamineUserList(query)
		return res
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
